package com.ybxx.base.model;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import com.ybxx.core.model.BaseModel;

@Entity
@Table(name="tbl_base_unit")
public class Unit extends BaseModel {
	@Id
	private String uid;
	@ManyToOne(targetEntity=Ban.class,fetch=FetchType.LAZY)
	@JoinColumn(name="bid",referencedColumnName="bid") 
	private Ban ban;
	private String uname;
	private String state;
	
	@OneToMany(targetEntity=Room.class,cascade={CascadeType.ALL},mappedBy="unit",fetch = FetchType.LAZY)
	private Set<Room> rooms=new HashSet<Room>();

	public String getUid() {
		return uid;
	}

	public void setUid(String uid) {
		this.uid = uid;
	}

	public Ban getBan() {
		return ban;
	}

	public void setBan(Ban ban) {
		this.ban = ban;
	}

	public String getUname() {
		return uname;
	}

	public void setUname(String uname) {
		this.uname = uname;
	}

	public String getState() {
		return state;
	}

	public void setState(String state) {
		this.state = state;
	}

	public Set<Room> getRooms() {
		return rooms;
	}

	public void setRooms(Set<Room> rooms) {
		this.rooms = rooms;
	}

	
	
	
	
	
}
